<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="/common/head :: commonHead('供应链后台管理系统')"></head>
<body>
<div class="main-layout" id='main-layout'>
    <!--侧边栏-->
    <div class="main-layout-side">
        <div class="m-logo">
            供应链后台管理系统
        </div>
        <ul id="menuUl" class="layui-nav layui-nav-tree" lay-filter="leftNav">
            <!-- 导航菜单 -->
        </ul>
    </div>
    <!--右侧内容-->
    <div class="main-layout-container">
        <!--头部-->
        <div class="main-layout-header">
            <ul id="friendshipLinkUl" class="layui-nav" style="float: left">

            </ul>
            <ul class="layui-nav" lay-filter="rightNav">


                <li class="layui-nav-item">
                    <a href="javascript:;" data-url="admin-info.html" data-id='5' data-text="个人信息"
                       style="color: #0e0e0e">老王</a>
                    <!--<a href="javascript:;" data-url="admin-info.html" data-id='5' data-text="个人信息"-->
                       <!--style="color: #0e0e0e" th:text="${session.user.name}"></a>-->
                    <!--<dl class="layui-nav-child"> &lt;!&ndash; 二级菜单 &ndash;&gt;-->
                        <!--<dd><a href="">个人资料</a></dd>-->
                        <!--<dd><a href="">修改密码</a></dd>-->
                    <!--</dl>-->
                </li>
                <li class="layui-nav-item"><a href="/logout" style="color: #0e0e0e">退出系统</a></li>
            </ul>
        </div>
        <!--主体内容-->
        <div class="main-layout-body">
            <!--tab 切换-->
            <div class="layui-tab layui-tab-brief main-layout-tab" lay-filter="tab" lay-allowClose="true">
                <ul class="layui-tab-title" style="padding-left: 10px">
                    <li class="layui-this welcome">后台主页</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <!--1-->
                        <iframe src="default" width="100%" height="100%" name="iframe" scrolling="auto"
                                class="iframe" framborder="0"></iframe>
                        <!--1end-->
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--遮罩-->
    <div class="main-mask">

    </div>
    <!--<input id="token" type="hidden" th:value="${session.user.token}" />-->
</div>
<span th:replace="/common/on-load-js :: commonOnLoadJs"></span>
<script th:src="#{commonMenuConfigUrl}"></script>
<script th:inline="javascript">
    var menulist = [[${session.user.menulist}]];
    var menulist_html = "";
    function genMenuHtml(){
        for (var i = 0; i < menulist.length; i++){
            var rootMenu = menulist[i];
            menulist_html += '<li class="layui-nav-item" data-id="'+rootMenu.menuid+'">';
            menulist_html += '<a href="javascript:;">'+rootMenu.name+'</a>';

            if(rootMenu.childs.length>0){
                menulist_html += '<dl class="layui-nav-child">';
            }
            console.log("rootMenu:"+rootMenu);
            console.log(rootMenu);
            for(var j = 0; j < rootMenu.childs.length; j++){
                var c1 = rootMenu.childs[j];
                console.log("c1:",c1);
                menulist_html += '<dd><a href="javascript:;" data-url="'+c1.url+'" data-id="'+c1.menuid+'" data-text="'+c1.name+'"><span class="l-line"></span>'+c1.name+'</a></dd>';

            }
            if(rootMenu.childs.length>0){
                menulist_html += '</dl>';
            }
            menulist_html += '</li>';
        }
        $("#menuUl").html(menulist_html);
    }
    $(document).ready(function(){
        genOtherSystemLink();
        genMenuHtml();
    });
    function genOtherSystemLink(){
        if(!meicun_menu) return;
        var html = "";
        var token = $("#token").val();
        for (var i = 0; i < meicun_menu.length; i++){
            var app = meicun_menu[i];
            var url = app.url + "?token=" + token;
            html += '<li class="layui-nav-item"><a href="'+url+'" target="_blank" style="color: #0e0e0e">'+app.name+'</a></li>';
        }
        html += '<li class="layui-nav-item"><a href="javascript:;" style="color: #0e0e0e">APP下载</a><dl class="layui-nav-child"><dd><a href="">美村耘信</a></dd><dd><a href="">金融借款</a></dd><dd><a href="">51农场</a></dd></dl></li>';
        $("#friendshipLinkUl").html(html);
    }
</script>
</body>
</html>